import React, { Component } from 'react'

export default class Son extends Component {
    state = {
        count : 5678
    }
    render() {
        const { count } = this.state
        const { acceptCount } = this.props
        // console.log(acceptCount)
        return (
            <div>
                {/* <h4>
                    { count }
                </h4>

                <button onClick={() => {
                    this.setState({
                        count: count += 1
                    })
                }}> +++ </button> */}

                <h4>
                    我是子组件 -- { count }
                </h4>

                <button onClick={() => {
                    this.setState({
                        count: this.state.count += 1
                    }, () => {
                        acceptCount(this.state.count)
                    })
                }}> +++ </button>

                <button onClick={ () => {
                    acceptCount(count)
                } }>点我传递</button>
            </div>
        )
    }
}
